package com.eq.cloud.controller;

import com.eq.cloud.entities.User;
import org.springframework.web.bind.annotation.*;

import java.util.Arrays;
import java.util.Date;
import java.util.List;


@RestController
@RequestMapping("user")
public class UserController {

@PostMapping
    public String add(@RequestBody User user){
    System.out.println(user);
    return "add ok";
}

@DeleteMapping("/{id}")
    public String delete(@PathVariable Integer id){

    System.out.println(id);
    return "delete ok";
}

@GetMapping
public List<User> findUser(String name,Integer age){
    System.out.println(name+","+age);
    return Arrays.asList(
            new User(1,"zhangsan",18,new Date()),
            new User(2,"lisi",120,new Date())
    );

}
}
